﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BAL.Controller;
using EntityObjects;

namespace PresentationLayer.View.StoreClerk
{
    public partial class ViewDeptReqList : System.Web.UI.Page
    {
        NotificationController nc = new NotificationController();
        List<Department> deptList;
        List<Category> category;
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
             Bind();
            }      
           
        }

        protected void Bind()
        {
            deptList = nc.getRequestedDepartmentByApprovedStatus();
            gv_ViewDeptReqList.DataSource = deptList;
            gv_ViewDeptReqList.DataBind();

        }


        protected void gv_ViewDeptReqList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Label3.Text = "hello1";
            if ((e.CommandName == "ViewDetails"))
            {
                Label4.Text = "hello2";
               string depId = gv_ViewDeptReqList.DataKeys[0].Value.ToString();
               // string depId = "POLS";
               // Panel1.Visible = true;
                int index = Convert.ToInt32(e.CommandArgument);
               // GridViewRow row = gv_ViewDeptReqListDetails.Rows[index];
              // HiddenField hdn1 = (HiddenField)row.FindControl("hdnDeptId");
            
               // category = nc.getRequestedCategorybyApprovedStatus(row.FindControl(depId).ToString());
                //category = nc.getRequestedCategorybyApprovedStatus(depId);
                Label5.Text = "hello3";
              // category = nc.getRequestedCategorybyApprovedStatus(row.);

                if (category != null && category.Count > 0)
                {
                    gv_ViewDeptReqListDetails.DataSource = category;
                    gv_ViewDeptReqListDetails.DataBind();
                    gv_ViewDeptReqListDetails.Visible = true;
                }

            }





        }

    }
}
